package main

import (
	"asy-cache-center/router"
	"fmt"
	"gopkg.in/yaml.v2"
	"os"
)

// 修改配置文件信息
func main() {
	// 读取配置文件
	conf := "./conf.yaml"
	f, err := os.Open(conf)
	if err != nil {
		fmt.Println("open file err = ", err)
		return
	}
	defer f.Close()
	// 解析配置文件
	decode := yaml.NewDecoder(f)
	siteinfo := make(map[string]string)
	err = decode.Decode(&siteinfo)
	if err != nil {
		fmt.Printf("yaml decode has error:%v\n", err)
		return
	}

	// 正式启动
	fmt.Println("开启端口：", siteinfo["port"])
	router.InitRouter(siteinfo["port"])
}
